// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_SYS_FC
// * CreateDate    : 2013-08-28 11:00:58
// * Creater       : CodeSmith
// * LastChangeDate: 2013-08-28 11:00:58
// * LastChanger   : 2013-08-28 11:00:58
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Sys
{
/// <summary>
    /// SysFc
    /// </summary>
    public partial class SysFcBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objSysFcEntity">Entity</param>
        /// <returns>Entity</returns>
        public static SysFcEntity GetSysFc(SysFcEntity objSysFcEntity)
        {
            return DataAccess.SelectSingle<SysFcEntity>(objSysFcEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objSysFcEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static SysFcEntity InsertSysFc(SysFcEntity objSysFcEntity)
        {
            objSysFcEntity.Id = Guid.NewGuid().ToString();
            objSysFcEntity.CreatedDate = DateTime.Now;
            DataAccess.Insert(objSysFcEntity);
            return objSysFcEntity;
        }

        public static bool InsertSysFc(List<SysFcEntity> objSysFcEntityList)
        {
            return DataAccess.Insert(objSysFcEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objSysFcEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateSysFc(SysFcEntity objSysFcEntity)
        {
            objSysFcEntity.UpdatedDate = DateTime.Now;
            return DataAccess.Update(objSysFcEntity);
        }

        public static bool UpdateSysFc(List<SysFcEntity> objSysFcEntityList)
        {
            return DataAccess.Update<SysFcEntity>(objSysFcEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objSysFcEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteSysFc(SysFcEntity objSysFcEntity)
        {
            return DataAccess.Delete(objSysFcEntity);
        }

        public static bool DeleteSysFc(List<SysFcEntity> objSysFcEntityList)
        {
            return DataAccess.Delete<SysFcEntity>(objSysFcEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetSysFcAll()
        {
            return DataAccess.SelectAllDataSet<SysFcEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<SysFcEntity> GetSysFcAllList()
        {
            return DataAccess.SelectAll<SysFcEntity>();
        }
        #endregion


        #region function
        public static DataSet GetSysFcByCondition(string rowCount,string condition)
        {
            string sql = @"select fc.*,p.name_cn as CREATED_PERSON,p2.name_cn as UPDATED_PERSON
from sys_fc fc left join mst_person p on fc.created_by=p.person_id
left join mst_person p2 on fc.updated_by=p2.person_id where 1=1 ";
            if (string.IsNullOrEmpty(condition) == false)
                sql += condition;
            DataSet ds = DataAccess.SelectDataSet(sql);
            return ds;
        }
        #endregion
    }
	
	
}	

